#include "gaitManager.h"
#include <iostream>
using namespace std;
gaitManager::gaitManager()
{
    //ctor
    m_port=transitHub::getInstance();
    if(!m_port->portOpen(1,57600))
        {
            p_loop=0;
        }
    p_loop=1;

}

gaitManager::~gaitManager()
{
    //dtor
}
void gaitManager::loop()
{
    gaitStep t_gait("loop",28);
    while(p_loop)
    {
        if(p_name_gait=="")
            continue;
            if(t_gait.name!=p_name_gait){
                t_gait.loadFile(p_name_gait);
                t_gait.name=p_name_gait;
                }
        t_gait.step=0;
        int data[20];
        while(t_gait.popData(data))
        {
            m_step=float(t_gait.step/t_gait.getLen());
            m_port->doLoopTx(data);
        }
    }
}
float gaitManager::getStep()
{
    return m_step;
}
